import { BaseService, Service, Permission } from "@/api/service";

@Service({
	namespace: "sys/attachment",
})
class SysAttachment extends BaseService {
	@Permission('upload')
	upload(data: any,config: any = {}) {
		return this.request({
			url: "/upload",
			method: "POST",
			data: data,
			...config
		});
	}
	@Permission('getBaseUrl')
	getBaseUrl(params: any) {
		return this.request({
			url: "/get_base_url",
			method: "GET",
			params: params
		});
	}
	@Permission('move')
	move(params: any) {
		return this.request({
			url: "/move",
			method: "POST",
			data: {
				...params
			}
		});
	}
	@Permission('remotePhoto')
	remotePhoto(params: any) {
		return this.request({
			url: "/remote_photo",
			method: "POST",
			data: {
				...params
			}
		});
	}

	@Permission('checkMd5')
	checkMd5(params: any) {
		return this.request({
			url: "/uploadCheck",
			method: "GET",
			params: params
		});
	}

	@Permission('UploadChunk')
	uploadChunk(data: any,config = {}) {
		return this.request({
			url: "/uploadChunk",
			method: "POST",
			data: data,
			...config
		});
	}

	@Permission('mergeChunk')
	mergeChunk(data: any,config = {}) {
		return this.request({
			url: "/mergeChunk",
			method: "POST",
			data: data,
			...config
		});
	}
}

export default new SysAttachment();
